#include <boost/filesystem.hpp>
#include <boost/mpi.hpp>
#include <cmath>
//#include <eigen3/Eigen/Dense>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
//#include "checkTwoPi.h"
//#include "checkVsTok.h"
// #include "../SRC/DF_Common/const_nucl.h"
// #include "../SRC/DF_Common/coupling_coeff.h"
// #include "../SRC/DF_Common/file_manage.h"
// #include "../SRC/DF_Common/get_input_file.h"
// #include "../SRC/DF_Common/package.h"
// #include "../SRC/DF_Common/serial_control.h"
// #include "../SRC/DF_Common/time_count.h"
// #include "../SRC/DF_Common/basis_state.h"
// #include "../SRC/DF_Mpi_Sep/antisym_coeff.h"
// #include "../SRC/DF_Mpi_Sep/cont_term.h"
// #include "../SRC/DF_Mpi_Sep/info_wave.h"
// #include "../SRC/DF_Mpi_Sep/ope_term.h"
// #include "../SRC/DF_Mpi_Sep/tpe_term.h"
// #include "../SRC/DF_Mpi_Sep/trans_coeff.h"
// #include "../SRC/DF_Mpi_Sep/wavefun_coeff.h"
#include "../SRC/DF_Mpi_Sep/main_control_part.h"
#include "nvtx3/nvToolsExt.h"

// using std::cin;
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
namespace bf = boost::filesystem;
// using namespace std;

int main() {
  nvtxRangePush("main");
  const std::string path_serial = "serial_dat";
  // bf::path path(path_s);
  if (!bf::exists(path_serial)) {
    bf::create_directory(path_serial);
  }
  const std::string path_out = "serial_dat/Output";
  // bf::path path(path_s);
  if (!bf::exists(path_out)) {
    bf::create_directory(path_out);
  }

  mpi::environment env_main;
  mpi::communicator MainCom;
  Eigen::initParallel();

  //   int a_test[1000];
  // #pragma acc parallel loop copyin(a_test[0:999])
  //   for (int i = 0; i < 100; i++) {
  //     a_test[i]=i;
  //   }

  // cout << " OpenACC test a_test " << endl;
  //
  // exit(0);

  string Input_file = "data/Input/DF.Input";
  Main_Control MC(Input_file);

  std::ifstream control_file;
  control_file.open("./Step_Control.Input");
  int Step_Flag = 0;
  // cout << " Please input Step_Flag (1, 2, 3) : " << endl;
  control_file >> Step_Flag;
  control_file.close();
  // cout << " Step_Flag = " << Step_Flag << endl;
  if (Step_Flag == 1) {
    MC.Step_I();
  } else if (Step_Flag == 2) {
    MC.Filename_Input = "data/Input/DF_press_test.Input";
    // MC.Step_II();
  } else if (Step_Flag == 3) {
    MC.Filename_Input = "data/Input/DF_press_test.Input";
    // MC.Step_III();
  } else {
    cout << " Wrong For Step_Flag (1, 2, or 3) " << endl;
    cout << "  Step_Flag = " << Step_Flag << endl;
    exit(0);
  }
  nvtxRangePop();
  // cout << " ==== ALL FINISHED ==== " << endl;
  // TC.start();
} /**/
